-
Couldn't load subscription status.
- Fork 314
Test connection pool concurrency #2605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: canary
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🔒 Entelligence AI Vulnerability Scanner ✅ No security vulnerabilities found! Your code passed our comprehensive security analysis. |
|
LGTM 👍 |
|
🌿 Preview your docs: https://boundary-preview-d8e8ff88-7b4c-4715-aa7c-cc64e505f31d.docs.buildwithfern.com |
| } | ||
|
|
||
| const server = http.createServer(async (req, res) => { | ||
| console.log(`${req.method} ${req.url}`); |
Check warning
Code scanning / CodeQL
Log injection Medium
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 15 days ago
To prevent log injection, any user-controlled values included in the log string (such as req.url and potentially req.method) should have line breaks (\r, \n) stripped or replaced. The best and simplest mitigation is to process each such value with String.prototype.replace(/\r|\n/g, "") before logging.
- In this file, on line 133, update the log entry to process both
req.methodandreq.urlthrough a sanitizing function that removes/replaces newlines and carriage returns. - If you want to make the fix most robust (and ensure code clarity/reuse), you can define a simple helper function (e.g.,
sanitizeForLog(str)) that takes a string and strips newlines, then use it for bothreq.methodandreq.urlin your log statement.
Apply these changes only to this file/snippet.
-
Copy modified lines R133-R137
| @@ -130,7 +130,11 @@ | ||
| } | ||
|
|
||
| const server = http.createServer(async (req, res) => { | ||
| console.log(`${req.method} ${req.url}`); | ||
| // Remove newlines to prevent log injection from user-controlled values | ||
| function sanitizeForLog(str) { | ||
| return String(str).replace(/[\r\n]/g, ""); | ||
| } | ||
| console.log(`${sanitizeForLog(req.method)} ${sanitizeForLog(req.url)}`); | ||
|
|
||
| try { | ||
| await handleRequest(req, res); |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
🌿 Preview your docs: https://boundary-preview-b6f11f33-0ad7-45a6-8f29-1e5860bd6738.docs.buildwithfern.com |
|
🌿 Preview your docs: https://boundary-preview-9a887667-f593-44a2-bad6-f4ce44c59e7a.docs.buildwithfern.com |
|
🌿 Preview your docs: https://boundary-preview-7171769d-7ecc-4e03-8c15-c61ef5236405.docs.buildwithfern.com |
|
🌿 Preview your docs: https://boundary-preview-31614581-1491-415a-8e73-43ef80b56e0f.docs.buildwithfern.com |
#2594